home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
276-300
/
297
/
devkit
/
rexx
/
commentblock.ced
< prev
next >
Wrap
Text File
|
1995-03-14
|
2KB
|
76 lines
/************************************************************************
*
* CommentBlock.ced Copyright (c) 1989, Peter Cherna
*
* ARexx program for CygnusEd Professional. Comments out the highlighted
* block. Because comments in C don't nest, all comment brackets within
* the block are changed to '«*' and '*»'. Any existing '«*' or '*»'
* are changed to '««*' or '*»»' respectively, ad infinitum.
*
* Version 1.11: August 20, 1989 Release 1.2: August 29, 1989
*
************************************************************************/
/* Allow CygnusEd to pass status variables */
options results
/* Tell ARexx to talk to CygnusEd */
address 'rexx_ced'
cr = '0A'x
/* Cut the original block out */
cut block
/* If the user did in fact have a block marked */
if result = 'RESULT' then
DO
/* Get the contents of the block buffer: */
status 60
string = result
/* Replace each occurrence of a '«*' with a '««*' */
p = pos('«*',string,1)
DO while (p > 0)
string = left(string,p) || '«' || substr(string,p+1)
p = pos('«*',string,p+3);
END
/* Replace each occurrence of a '*»' with a '*»»' */
p = pos('*»',string,1)
DO while (p > 0)
string = left(string,p) || '»' || substr(string,p+1)
p = pos('*»',string,p+3)
END
/* Replace each occurrence of an open comment with a '«*' */
p = pos('/*',string,1)
DO while (p > 0)
string = left(string,p-1) || '«*' || substr(string,p+2)
p = pos('/*',string,p+2)
END
/* Replace each occurrence of a close comment with a '*»' */
p = pos('*/',string,1)
DO while (p > 0)
string = left(string,p-1) || '*»' || substr(string,p+2)
p = pos('*/',string,p+2)
END
/* Replace the block, surrounded by comments: */
text '/*'||cr
text string
text '*/'||cr
END
else
DO
/* Display problem (would be "No block marked") */
okay1 result
END
exit